ABC166 D - I hate Factorization
提出
WA
code: python
x = int(input())
for i in range(pow(10, 3)):
for j in range(0, -pow(10, 3), -1):
if (pow(i, 5) - pow(j, 5) == x):
print(i, j)
exit()
解答
code: python
x = int(input())
for i in range(-200, 200):
for j in range(-200, 200):
if (pow(i, 5) - pow(j, 5) == x):
print(i, j)
exit()
メモ
提出
code: python
import itertools
x = int(input())
# 計算量
nums = set()
for i in range(-1000, 1000):
nums.add((i, pow(i, 5)))
# numsから2つ選ぶ
for i in itertools.permutations(nums, 2):
exit()